<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="lib/core/Utility/LBUtility.js"type="text/javascript"></script>
<script src="lib/org/Frame/Frame.js"type="text/javascript"></script>
<title>帧引擎测试</title>
</head>
<header>
<h1>帧引擎测试</h1>
</header>
<body>

<div>Frame:<span id="frame">-</span></div>
<div>Status:<span id="status">-</span></div>
<div>FPS:<span id="fps">-</span></div>
<button id="action_start">start</button>
<button id="action_pause">pause</button>
<button id="action_resume">resume</button>
<button id="action_stop">stop</button>
<button id="action_fps_add">FPS +</button>
<button id="action_fps_sub">FPS -</button>
<script type="text/javascript">

function	printEventStatus (event) {
	
	document.getElementById('status').innerHTML = event._target._status;
}

document.getElementsByTagName('body')[0].onload	= function () {
	LBUtility.getInstance().ready(function () {
		
		Frame.initailize();
	
		var	frameEngine	= new Frame(
			{
				"FPS"	: 1
			}
		);
		frameEngine.addEventListener(
			'frame.enterFrame',
			function (event) {
	
				document.getElementById('frame').innerHTML = event._target._currentFrame;
			}
		);
		frameEngine.addEventListener('frame.start', printEventStatus);
		frameEngine.addEventListener('frame.pause', printEventStatus);
		frameEngine.addEventListener('frame.resume', printEventStatus);
		frameEngine.addEventListener('frame.stop', printEventStatus);
		document.getElementById('status').innerHTML = frameEngine._status;
		document.getElementById('fps').innerHTML 	= frameEngine._currentFPS;
		
		document.getElementById('action_start').onclick	= function () {
	
			frameEngine.start();
		}
		document.getElementById('action_pause').onclick	= function () {
	
			frameEngine.pause();
		}
		document.getElementById('action_resume').onclick	= function () {
	
			frameEngine.resume();
		}
		document.getElementById('action_stop').onclick	= function () {
	
			frameEngine.stop();
		}
		document.getElementById('action_fps_add').onclick	= function () {
	
			frameEngine.changeFPS(frameEngine._currentFPS + 1);
			document.getElementById('fps').innerHTML 	= frameEngine._currentFPS;
		}
		document.getElementById('action_fps_sub').onclick	= function () {
	
			frameEngine.changeFPS(frameEngine._currentFPS - 1);
			document.getElementById('fps').innerHTML 	= frameEngine._currentFPS;
		}
	});
}
</script>
</body>
<footer>
sanders.yao@gmail.com
</footer>
</html>